package pl.squeaky.mvc.util;

import org.eclipse.core.resources.IFile;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.ide.IDE;

public class IDEUtils {
	private IDEUtils() {
	}
	
	public static void open(IFile file) {
		IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
		
		try {
			IDE.openEditor(page, file, true);
		} catch (PartInitException e) {
			throw new RuntimeException(e);
		}
	}
}
